<#include "/common/commoncss.ftl">
<link rel="stylesheet" type="text/css" href="css/common/checkbox.css"/>
<link rel="stylesheet" type="text/css" href="css/common/tanchuang.css"/>
<script type="text/javascript" src="js/task/task.js"></script>
<style type="text/css">
    a {
        color: black;
    }

    a:hover {
        text-decoration: none;
    }


    .text {
        min-height: 114px;
    }

    .reciver {
        position: relative;
        top: -24px;
        float: right;
        right: 4px;
        cursor: pointer;
    }
</style>
<div class="row" style="padding-top: 10px;">
    <div class="col-md-2">
        <h1 style="font-size: 24px; margin: 0;" class="">任务管理</h1>
    </div>
    <div class="col-md-10 text-right">
        <a href="##"><span class="glyphicon glyphicon-home"></span> 首页</a> > <a
                disabled="disabled">任务管理</a>
    </div>
</div>
<div class="row" style="padding-top: 15px;">
    <div class="col-md-12">

        <div class="bgc-w box">
            <!--盒子头-->
            <div class="box-header">
                <h3 class="box-title">
                    <a href="taskmanage?page=${nowPage}" class="label label-default"
                       style="padding: 5px;">
                        <i class="glyphicon glyphicon-chevron-left"></i> <span>返回</span>
                    </a>
                </h3>
            </div>

            <!--盒子身体-->
            <form action="ck_addtask" method="post" onsubmit="return check();">
                <div class="box-body no-padding">
                    <div class="box-body">
                        <!--錯誤信息提示  -->
                        <div class="alert alert-danger alert-dismissable" role="alert" style="display: none;">
                            错误信息:
                            <button class="thisclose close" type="button">&times;</button>
                            <span class="error-mess"></span>
                        </div>
                        <div class="row">

                            <div class="col-md-6 form-group">
                                <label class="control-label"> <span>类型</span></label>
                                <select class="form-control" name="typeId">
                                    <#list typelist as type>
                                        <#if type.typeModel=="aoa_task_list">
                                            <#if type.typeId ==3>
                                            <#else>
                                                <option value="3">公事</option>
                                            </#if>
                                            <#if type.typeId ==4>
                                            <#else>
                                                <option value="4">私事</option>
                                            </#if>
                                        </#if>
                                    </#list>
                                </select>
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">状态</label>
                                <select class="form-control" name="statusId">
                                    <#list statuslist as status>
                                        <#if status.statusModel=="aoa_task_list">
                                            <option value="${status.statusId}">${status.statusName}</option>
                                        </#if>
                                    </#list>
                                </select>
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">开始日期</label> <input id="starTime" name="starTime"
                                                                                 class="form-control"/>
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">结束日期</label> <input id="endTime" name="endTime"
                                                                                 class="form-control"/>
                            </div>
                            <div class="col-md-6 form-group">

                                <label class="control-label">标题</label> <input name="title"
                                                                               type="text" id="title_Name"
                                                                               class="form-control"/>
                            </div>
                            <div class="col-md-6 form-group" style="position: relative;">
                                <label class="control-label" data-toggle="modal" data-target="#myModal">接收人</label>
                                <input name="reciverlist" type="text" id="recive_list"
                                       class="form-control " readonly="readonly" style="background-color:#fff;"/>
                                <div class="reciver">
								<span class="label label-success glyphicon glyphicon-plus"
                                      data-toggle="modal" data-target="#myModal">通讯录</span>
                                </div>
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">描述</label>
                                <textarea class="form-control text" name="taskDescribe"></textarea>
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">评价</label>
                                <textarea class="form-control text" name="comment"></textarea>
                            </div>
                            <div class="col-md-6 form-group ">
                                <label class="control-label">置顶</label> <br/>
                                <span class="labels"><label><input type="checkbox" name="top"
                                                                   class="val"><i>✓</i></label></span>
                            </div>

                            <#--						<div class="col-md-6  form-group"> -->
                            <#--							<label class="control-label">取消</label> <br /> <span-->
                            <#--								class="labels"><label><input type="checkbox" name="cancel" class="val"><i>✓</i></label></span>-->
                            <#--						</div>-->
                        </div>
                    </div>
                </div>
                <!--盒子尾-->
                <div class="box-footer">
                    <input class="btn btn-primary" id="save" type="submit" value="保存"/>
                    <input class="btn btn-default" id="cancel" type="button" value="取消"
                           onclick="remove()"/>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- 接收人弹窗-->
<#include "/common/reciver.ftl">

<!--校验模态框 -->

<#include "/common/modalTip.ftl">
<script type="text/javascript">
    //表单提交前执行的onsubmit()方法；返回false时，执行相应的提示信息；返回true就提交表单到后台校验与执行
    function check() {
        console.log("开始进入了");
        //提示框可能在提交之前是block状态，所以在这之前要设置成none
        $('.alert-danger').css('display', 'none');
        var isRight = 1;
        $('.form-control').each(function (index) {
            // 如果在这些input框中，判断是否能够为空
            if ($(this).val() == "") {
                // 排除哪些字段是可以为空的，在这里排除
                if (index == 7 || index == 8 || index == 9) {
                    return true;
                }

                // 获取到input框的兄弟的文本信息，并对应提醒；
                var brother = $(this).siblings('.control-label').text();
                var errorMess = "[" + brother + "输入框信息不能为空]";
                // 对齐设置错误信息提醒；红色边框
                $(this).parent().addClass("has-error has-feedback");
                $('.alert-danger').css('display', 'block');
                // 提示框的错误信息显示
                $('.error-mess').text(errorMess);
                // 模态框的错误信息显示
                $('.modal-error-mess').text(errorMess);
                isRight = 0;
                return false;
            } else {
                // 在这个里面进行其他的判断；不为空的错误信息提醒
                return true;
            }
        });
        if (isRight == 0) {
            //modalShow(0);
            return false;
        } else if (isRight == 1) {
            //modalShow(1);
            return true;
        }
//	return false;
    }

    function remove() {
        location.href = "taskmanage?page=${nowPage}";
    }
</script>
<script type="text/javascript" src="js/common/data.js"></script>
<script type="text/javascript" src="plugins/My97DatePicker/WdatePicker.js"></script>